package com.controller.home;

import com.controller.BaseController;
import com.entity.News;
import com.service.imple.home.NewsServiceImple;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("home/News")
public class NewsController extends BaseController<NewsServiceImple> {

    @RequestMapping("toNews")
    public String toNews(Integer catalogId,ModelMap modelMap){
        Map<String,Object> map = new HashMap<>();
        map.put("catalogId",catalogId);
        List<News> list = BaseService.select(map);
        modelMap.put("list",list);
        return "news/index";
    }

    @RequestMapping("detail")
    public String detail(Integer id,ModelMap modelMap){
        Map<String,Object> map = new HashMap<>();
        map.put("id",id);
        List<News> list = BaseService.select(map);
        modelMap.put("list",list);
        return "news/detail";
    }
}
